// IPSMtest.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "gtest/gtest.h"
#include "IPSMtest.h"
#include <stdio.h>
/* Inital the environment for testing*/

int _tmain(int argc, _TCHAR* argv[])
{
	testing::InitGoogleTest(&argc, argv);
	return RUN_ALL_TESTS();
}

class IPSMtest:public testing::Test
{
protected:
	static void SetUpTestCase()
	{
		ipsm = new Storage("IPSM/test.txt");
		sd = new Storage("Storage Card/test.txt");
	}
	static void TearDownTestCase()
	{
		delete ipsm;
		delete sd;
		ipsm = NULL;
		sd = NULL;
	}
	static Storage* ipsm;
	static Storage* sd;
};
Storage* IPSMtest::ipsm = NULL;
Storage* IPSMtest::sd = NULL;

//****************************************************************************************/
//Function: Create a file on IPSM or SD card
//Purpose: Create a file and test the speed of write.
//Return: If successful occurs, the return value is 0, otherwise it return 1.
//****************************************************************************************/
TEST_F(IPSMtest,IPSM_WRITE)
{
	EXPECT_EQ(0,ipsm->test_write());
}
//****************************************************************************************/
//Function: Read a file on IPSM or SD card
//Purpose: Find the file and test the speed of read.
//Return: If successful occurs, the return value is 0, otherwise it return 1.
//****************************************************************************************/
TEST_F(IPSMtest,IPSM_READ)
{
	EXPECT_EQ(0,ipsm->test_read());
}
TEST_F(IPSMtest,SD_WRITE)
{
	EXPECT_EQ(0,sd->test_write());
}
TEST_F(IPSMtest,SD_READ)
{
	EXPECT_EQ(0,sd->test_read());
}